﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class DanhSachTinRaoVatThuocDanhMucCon : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int intId = -1;

        if (Request.QueryString["id"] != null)
        {
            intId = Int32.Parse(Request.QueryString["id"]);
         
        }
        else
        {
            return;
        }

        LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();



        danhsachhot.ListTinRaoVat = linQ.TIN_RAO_VATs.Where(tinraovat => tinraovat.MaLoaiTinRaoVat == CMyStaticFunction.layMaTinRaoVatHot()
            && tinraovat.Deleted == false && tinraovat.MaDanhMucCon == intId
).OrderByDescending(tinraovat => tinraovat.ThoiGianDang).Take(10).ToList();

        danhmuccon.MaDanhMucCon = intId;
        var query = linQ.DANH_MUC_CONs.Where(t => t.MaDanhMucCon == intId);

        if(query.Count() > 0)
        {
            Label1.Text = query.First().TenDanhMucCon.ToUpper();
        }
    }
   
}
